import NProgress from 'nprogress' // progress bar

NProgress.configure({ showSpinner: false })
NProgress.css = {
    'background-color': 'red'
}

export default (router) => {
    router.beforeEach(async(to, from, next) => {
        if (from.name && to.name !== 'distribute') {
            // start progress bar
            NProgress.start()
        }

        next()
    })

    router.afterEach(() => {
        // finish progress bar
        NProgress.done()
    })
}